<template>
	<view :class="['page',{'iphoneX':isIphoneX}]">
		<template v-if="isLogin">
			<view class="body">
				<view class="form-wrap m-b2">
					<view class="map">
						<map style="width: 100%; height: 400rpx;" :polyline="polylines" scale="16"
							:latitude="params.latitude" :longitude="params.longitude" :markers="markers" :circles="circles">
						</map>
					</view>
					<view class="form-item">
						<view class="label">防控地址：</view>
						<view class="form-input">
							<template v-if="params.address">
								<view class="content">
									<textarea class="inp" auto-height disabled v-model="params.address" placeholder="获取位置中..."
										maxlength="-1"></textarea> 
								</view>
							</template>
							<template v-else>
								<view class="content" @click="getLocal">
									<textarea class="inp" auto-height disabled v-model="params.address" placeholder="获取位置中..."
										maxlength="-1"></textarea>
									<view class="icon">
										<view class="iconfont f-s42 f-blue">&#xe648;</view>
									</view>
								</view>
							</template>
						</view>
					</view>

					<view class="form-item" v-if="params.address">
						<view class="label">经纬度：</view>
						<view class="form-input">
							<view class="content">
								<input type="text" class="inp" v-model="params.location" disabled placeholder="输入经纬度" />
							</view>
						</view>
					</view>

					<view class="form-item">
						<view class="label">选择生境类型：</view>
						<template v-if="params.envtype">
							<picker class="form-picker" mode="selector" :range="envtypes" @change="changeEnvtypes">
								<view class="picker">
									<input type="text" class="select-data t-l" v-model="params.envtype"
										placeholder="选择生境类型" disabled>
									<view class="icon">
										<view class="iconfont f-s68">&#xeb8a;</view>
									</view>
								</view>
							</picker>
						</template>
						<template v-else>
							<view class="form-input">
								<view class="content">
									<input type="text" class="inp" v-model="params.envtype" placeholder="输入生境类型" />
								</view>
							</view>
						</template>
					</view>
					
					<view class="form-item">
						<view class="label">扑杀蚁巢数：</view>
						<view class="form-input">
							<view class="content">
								<input type="number" class="inp" value="1"
									placeholder="输入扑杀蚁巢数(选填)" disabled/>
								<view class="link">个</view>
							</view>
						</view>
					</view> 
					<view v-if="uuid" class="form-item">
						<view class="label">溯源码：</view>
						<view class="form-input">
							<view class="content">
								<input type="text" class="inp" v-model="uuid" disabled placeholder="溯源码" />
							</view>
						</view>
					</view>
					<view v-if="reward_projects.length>0" class="form-item">
						<view class="label">参与项目：</view>
						<template v-if="reward_projects.length>0&&!pro_id">
							<picker class="form-picker" mode="selector" :range="reward_projects" range-key="name" @change="changeUserProject">
								<view class="picker">
									<input type="text" class="select-data t-l" v-model="reward_project.name"
										placeholder="选择参与项目" disabled>
									<view class="icon">
										<view class="iconfont f-s68">&#xeb8a;</view>
									</view>
								</view>
							</picker>
						</template>
						<template v-else>
							<view class="form-input">
								<view class="content">
									<textarea class="inp" auto-height disabled v-model="reward_project.name" placeholder="参与项目"
										maxlength="-1"></textarea>  
								</view>
							</view>
						</template>
					</view> 
					
				</view>

				<!-- 图片上传 -->
				<view class="form-wrap m-b2">
					<view class="upload-pic-item">
						<view class="label">撒药前照片:</view>
						<view class="form-upload-pic">
							<template>
								<view class="img-item" v-for="(item,index) in params.files0" :key="index">
									<image src="@/static/images/filter_bg.png" mode="widthFix">
										<!-- 占位 -->
									</image>
									<view class="img-wrap" @click="previewPic(index,0)">
										<image class="img" :src="item.url" mode="widthFix"></image>
									</view>
									<view class="del-icon" @click="delPic(index,0)">
										<view class="iconfont">&#xe74b;</view>
									</view>
									<view v-if="item.status==0" class="loading-img">
										<div class="loading-icon loader-18"></div>
									</view> 	 
								</view>
							</template>
							<view v-if="params.files0.length<1" class="img-item add-btn" @click="uploadImage(0)">
								<image src="@/static/images/upload_pic.png" mode="widthFix"></image>
							</view>
						</view>
					</view>
				</view>
				
				<!-- 图片上传 -->
				<view class="form-wrap m-b2">
					<view class="upload-pic-item">
						<view class="label">撒药后照片:</view>
						<view class="form-upload-pic">
							<template>
								<view class="img-item" v-for="(item,index) in params.files1" :key="index">
									<image src="@/static/images/filter_bg.png" mode="widthFix">
										<!-- 占位 -->
									</image>
									<view class="img-wrap" @click="previewPic(index,1)">
										<image class="img" :src="item.status==1?$imgPath(item.file_path):item.url" mode="widthFix"></image>
									</view>
									<view class="del-icon" @click="delPic(index,1)">
										<view class="iconfont">&#xe74b;</view>
									</view>
									<view v-if="item.status==0" class="loading-img">
										<div class="loading-icon loader-18"></div>
									</view> 	 
								</view>
							</template>
							<view v-if="params.files1.length<1" class="img-item add-btn" @click="uploadImage(1)">
								<image src="@/static/images/upload_pic.png" mode="widthFix"></image>
							</view>
						</view>
					</view>
				</view>

				<view class="form-wrap m-b2">
					<view class="form-textarea-item">
						<view class="label a-t">备注信息</view>
						<view class="form-textarea">
							<textarea class="inp-textarea" v-model="params.remark" placeholder="备注信息(选填),如地块名称等" maxlength="-1"></textarea>
						</view>
					</view>
				</view>

			</view>

			<!-- 底部 -->
			<view class="footer">
				<view class="fix-wrap bottom">
					<view class="btn" @click="submit">提交</view>
				</view>
			</view>


		</template>
	</view>
</template>

<script>
	import {
		dateFormat,
		uploadImage,
		previewImage,
		uploadToServe,
		d2Dms
	} from '@/common/util.js'
	import {gd_map_Key,gd_map_Key_web} from '@/config.js'
	import {
		createdRules,fkSuccessTips
	} from '@/common/redPack.js'
	import {
		getSystemInfo
	} from '@/common/promise.js'
	export default {
		name: 'name',
		data() {
			return {
				isLogin: true,
				isIphoneX: getApp().globalData.isIphoneX,
				userInfo: uni.getStorageSync('userInfo'),
				isStop: true,
				envtypes: [], 
				devnumber:'',
				uuid:'',
				pro_id:'',
				type:'default',
				catch_local:uni.getStorageSync('local'),
				isSaveData:false,   // 是否保存上次数据
				prev_data:{},
				params: {
					location: '',
					latitude: '',
					longitude: '',
					prevlatitude: '',
					prevlongitude: '',
					fid:0,
					address: '',
					envtype: ''||uni.getStorageSync('fk_data').env_type,
					fk_area: "",
					bait_count: '',
					kill_count: '1',
					files: [],   // 总图片
					files0:[],   // 撒药前
					files1:[],   // 撒药后
					remark: ''||uni.getStorageSync('fk_data').remark,
					weather: '',
					temperature: '',
					humidity: '',
					altitude: '',
					speed:'',
					accuracy:''
				},
				marker_id: 1,
				markers: [],
				circles: [{
					latitude: '',
					longitude: '',
					color: "#ff00000A",
					fillColor: "#ff00003A",
					radius: "50"
				}],
				polylines: [{
					points: [],
					color: "#fcd535",
					width: 10
				}], 
				is_active_area:false, 
				reward_project:{
					id:'',
					name:''
				},
				reward_projects:[ ],
				project_list:[],
				isStudy:'',    // 是否学习 
			}


		},
		async onLoad(params) { 
			console.log(params)
			this.isLogin = await this.$loginState('check'); 
			this.isStudy=params.isStudy;
			 
			
			// 扫码进入
			if(params.type=='scan'){  
				this.type=params.type;
				this.devnumber=params.devnumber;
				this.uuid=params.uuid;
				this.pro_id=params.pro_id; 
			}
			
			
			
			this.prev_data=uni.getStorageSync('prev_yfk_'+this.params.pid);    // 上次未提交数据
			if (this.isLogin) {
				this.getUserInfo();
				this.getLocal();
				this.getEnvtype();
				
				if(this.type=='scan'){ 
					this.project_list=await this.qmfkProjectList();	
					if(this.pro_id>0){ 
						this.reward_project=this.project_list[0]; 
						this.reward_projects=this.project_list;  
					}
				}else{						
					if(this.userInfo.prolist&&this.userInfo.prolist.length>0){						
						this.reward_project=this.userInfo.prolist[0];
						this.reward_projects=this.userInfo.prolist;  
					}					
				}
				
				
			}
		},
		async onShow() { 
			 

		},
		onHide() {
			clearInterval(this.timer);    // 关闭轮询位置定时器
		},
		onUnload() {			 
			clearInterval(this.timer);    // 关闭轮询位置定时器
		},
		methods: {
 
			
			// 获取用户信息
			getUserInfo:async function(){
				let res=await this.$api.user_api.getUserInfo();   
				if(res.data.ret==0){ 
					this.userInfo=res.data.data;   
					if(res.data.data.prolist.length>0 && this.type!='scan'){
						this.project_list=res.data.data.prolist;	
						this.reward_project=res.data.data[0];
						this.reward_projects=res.data.data; 
					}					
				}
			}, 
			
			// 获取全民防控列表
			qmfkProjectList:async function(district){
				let res=await this.$api.pro_api.qmfkProjectList({
					id:this.pro_id
				})   
				if(res.data.ret==0){					
					return res.data.data;					 
				}
			},
			
			// 切换项目
			changeUserProject:function(e){
				this.reward_project=this.reward_projects[e.detail.value]; 
			},			

			// 获取当前位置
			getLocal: function() {

				let _this = this;
				uni.showLoading({
					title:"获取位置中..."
				})
				uni.getLocation({
					type: 'gcj02',
					geocode:true,
					isHighAccuracy: true,
					success: function(res) {   
						uni.hideLoading();
						let lat=d2Dms(parseFloat(res.longitude).toFixed(6));   // d2Dms方法 转为度分秒格式
						let lng=d2Dms(parseFloat(res.latitude).toFixed(6));    // d2Dms方法 转为度分秒格式
						_this.params.location =lat + '，' + lng;						 					
						_this.params.latitude = res.latitude;
						_this.params.longitude = res.longitude; 
						_this.params.altitude=res.altitude;
						_this.params.speed=res.speed;
						_this.params.accuracy=res.accuracy; 
						 
						_this.circles[0].latitude=_this.params.latitude;
						_this.circles[0].longitude= _this.params.longitude; 
						
						_this.markers[0] = {
							id: 0,
							latitude: parseFloat(_this.params.latitude),
							longitude: parseFloat(_this.params.longitude),
							iconPath: '/static/images/my_local.png', 
						}
						
						_this.getCityInfo(res.latitude,res.longitude);   // 根据坐标获取城市信息
						 
					},
					fail() {
						uni.hideLoading();
						uni.showToast({
							icon:"none",
							title:'获取位置失败',
							mask:true,
							duration:2000,
							success() { 
							}
						})
					}
				});
			},
			
			// 更新轨迹点
			updateLocus: function() {
				let _this = this; 
				uni.getLocation({
					type: 'gcj02',
					isHighAccuracy: true,
					altitude:true,
					highAccuracyExpireTime:5000,
					accuracy:50,
					success: function(res) {	
						console.log('获取位置') 
						//  判断是否相同地址范围 设置位置偏差
						let difx = Math.abs(_this.params.prevlongitude - res.longitude);
						let dify = Math.abs(_this.params.prevlatitude - res.latitude);
						
						if(res.accuracy<=30){
							if ((_this.params.prevlongitude == '' || _this.params.prevlatitude == '') || (difx > 0.00005 && difx < 0.0035) || (dify > 0.00005 && dify < 0.0035)) {
								console.log('位置变化')
							  _this.params.accuracy = res.accuracy;
							  _this.params.latitude = res.latitude;
							  _this.params.longitude = res.longitude;
							  _this.params.speed = res.speed;
							  _this.params.altitude = res.altitude;
							  
							  _this.circles[0].latitude= _this.params.latitude;
							  _this.circles[0].longitude= _this.params.longitude;
							  
							  _this.markers[0] = {
							  	id: 0,
							  	latitude: parseFloat(res.latitude),
							  	longitude: parseFloat(res.longitude),
							  	iconPath: '/static/images/my_local.png', 
							  }					
								
								let local = {
									latitude: parseFloat(res.latitude),
									longitude: parseFloat(res.longitude),
								}
								_this.polylines[0].points.push(local);
								
							  _this.addLocus(); 
							}
						} 					
					},
					fail() {
						uni.hideLoading();
						uni.showToast({
							icon:"none",
							title:'获取位置失败',
							mask:true,
							duration:2000,
							success() { 
							}
						})
					}
				});
			},
 
			// 选择位置
			chooseAgress: function() {				 
				let _this = this;
				uni.chooseLocation({
					latitude: this.params.latitude,
					longitude: this.params.longitude,
					success: function(res) {  						
						_this.params.latitude = res.latitude;
						_this.params.longitude = res.longitude;  						
			 
						_this.getCityInfo(res.latitude,res.longitude);   //  获取新地址城市信息
					}
				})
			},

			//获取天气信息
			getWeatherInfo:async function(adcode) {  
				let res=await this.$api.yfk_api.getWeather({
					key:gd_map_Key_web,
					city:adcode
				})  
				if(res != false && res.data.info == "OK"){ 
					if (res.data.lives.length > 0) { 
						this.params.weather = res.data.lives[0].weather;
						this.params.temperature = res.data.lives[0].temperature;
						this.params.humidity = res.data.lives[0].humidity;
					}
				}
				  
			},
			
			// 获取城市信息
			getCityInfo:async function(lat,lng){ 
				let res=await this.$api.yfk_api.getCityInfo({
					key:gd_map_Key_web,
					location:lng+','+lat
				})      
			 
				if(res.data.status==1){  	 
					this.loading=false;
					this.params.address= res.data.regeocode.formatted_address;
					this.getWeatherInfo(res.data.regeocode.addressComponent.adcode);    // 根据adcode 获取天气信息
 		
				 
					if(this.type!='scan'||this.pro_id==0){
						let p_arr=[]; 
						this.test=':'+this.type+'_'+this.pro_id+'@'+res.data.regeocode.addressComponent.adcode+'@'+this.params.address;
						if(this.project_list.length>0){
							this.project_list.forEach(item=>{
								this.test += '!'+item.district;
								if(item.district==res.data.regeocode.addressComponent.adcode){
									this.test += '*';
									p_arr.push(item);								 
								} 
							}) 
							this.reward_project=p_arr[0];
							this.reward_projects=p_arr;  
						}
						
					} 				
				}
			},

			// 获取生境类型
			getEnvtype: async function() {
				let res = await this.$api.yfk_api.getEnvtype();
				if (res.data.ret == 0) {
					res.data.data.envtypes.push('其他')
					this.envtypes = res.data.data.envtypes;
					if(!uni.getStorageSync('fk_data').env_type){
						this.params.envtype = res.data.data.envtypes[0];
					}					
				}
			},

			// 上传图片
			uploadImage: function(type) { 
				// type 0 撒药前   1  撒药后
				let _this = this;
				if(type==0){
					uploadImage({
						length: _this.params.files0.length,
						maxSize: 1,
						sourceType:['camera'],
						success(res) { 
							
							let params_data = {};
							params_data.status = 0;
							params_data.url = res.tempFilePaths[0];
							_this.params.files0.push(params_data); 
							uploadToServe({
								url: '/yfk/upload-file',
								filePath: res.tempFilePaths[0],
								name: 'photo',
								formData: {
									'p_id': 0,
									'uid': _this.userInfo.id
								}
							}).then((up_res) => { 
								if (up_res.ret == 0) {								
									params_data.file_name = up_res.data.file_name;
									params_data.file_path = up_res.data.file_path;
									params_data.file_type = up_res.data.file_type;
									params_data.status = up_res.data.status;
									params_data.type = up_res.data.type; 								
								}
							}).catch((err)=>{ 
							})
						}
					})
				}else if(type==1){
					uploadImage({
						length: _this.params.files1.length,
						maxSize: 1,
						sourceType:['camera'],
						success(res) {  
							let params_data = {};
							params_data.status = 0;
							params_data.url = res.tempFilePaths[0];
							_this.params.files1.push(params_data); 
							uploadToServe({
								url: '/yfk/upload-file',
		    					filePath: res.tempFilePaths[0],
								name: 'photo',
								formData: {
									'p_id': 0,
									'uid': _this.userInfo.id
								}
							}).then((up_res) => {  
								if (up_res.ret == 0) {								
									params_data.file_name = up_res.data.file_name;
									params_data.file_path = up_res.data.file_path;
									params_data.file_type = up_res.data.file_type;
									params_data.status = up_res.data.status;
									params_data.type = up_res.data.type; 								
								}
							}).catch((err)=>{ 
							})
						}
					})
				}
				
			},

			// 预览图片
			previewPic: function(index,type) {
				let _this = this;
				let preview_data = [];
				if(type==0){
					this.params.files0.forEach(item => {
						preview_data.push(item.url);
					})
				}else if(type==1){
					this.params.files1.forEach(item => {
						preview_data.push(item.url);
					})
				}
				
				previewImage({
					data: preview_data,
					index: index
				})
			},

			// 删除图片
			delPic:async function(index,type) {
				if(type==0){
					let res=await this.$api.ycj_api.deletefile({
						file_path:this.params.files0[index].file_path
					}) 
					if(res.data.ret==0){
						this.params.files0.splice(index, 1);
					} 
					this.params.files0.splice(index, 1);
				}else if(type==1){
					let res=await this.$api.ycj_api.deletefile({
						file_path:this.params.files1[index].file_path
					}) 
					if(res.data.ret==0){
						this.params.files1.splice(index, 1);
					} 
					this.params.files1.splice(index, 1);
				}
				
			},
 

			// 切换生境
			changeEnvtypes: function(e) {
				if (e.detail.value == this.envtypes.length - 1) {
					this.params.envtype = '';
				} else {
					this.params.envtype = this.envtypes[e.detail.value];
				}
			},

			// 提交数据
			submit: async function() { 
				let _this = this;
				let system = await getSystemInfo(); //  获取系统信息
				
				if (this.params.envtype == '') {
					uni.showToast({
						icon: 'none',
						title: '请输入生境类型',
						mask: true,
						duration: 1000
					})
					return
				}; 		
					
				 
				 
				if (this.params.files0.length == 0) {
					uni.showToast({
						icon: 'none',
						title: '请上传撒药前照片',
						mask: true,
						duration: 1000
					})
					return
				};
				
				if (this.params.files1.length == 0) {
					uni.showToast({
						icon: 'none',
						title: '请上传撒药后照片',
						mask: true,
						duration: 1000
					})
					return
				};
				
				this.params.files = this.params.files0.concat(this.params.files1);
				for (let i in this.params.files) {
					if (this.params.files[i].status == 0) {
						uni.showToast({
							icon: 'none',
							title: '照片还未上传完',
							mask: true,
							duration: 1000
						})
						return false;
					}
				}
								
				
				// 判断是否已绑定微信
				if(this.userInfo.is_nx==1&&this.userInfo.wx_open_id==''){					
					createdRules({
						systemInfo: system,
						msg:'该区域项目正在进行全民防控作业领微信红包活动，请先授权微信绑定账号。'
					}) 					 
					return 
				}				
				
				if (this.isStop) {  
					this.isStop = false; 
					this.submitEvent();
				}
			},
			
			submitEvent:async function(){   
				let _this=this;				 
				let system = await getSystemInfo(); //  获取系统信息
				let res = await this.$api.yfk_api.addFkData({
					'files': JSON.stringify(this.params.files),
					'fid': this.params.fid,
					'gcj02_lat': this.params.latitude,
					'gcj02_lng': this.params.longitude,
					'address': this.params.address,
					'env_type': this.params.envtype,
					'fk_area': 0,      
					'bait_count': this.params.bait_count,
					'kill_count': this.params.kill_count,  // 活动推广项目/常规项目
					'create_uid': this.userInfo.id,
					'weather': this.params.weather,
					'temperature': this.params.temperature,
					'humidity': this.params.humidity,
					'altitude': this.params.altitude,
					'remark': this.isStudy?'实操数据':this.params.remark, 
					'gl_proid':this.reward_project?this.reward_project.id:0,     // 活动推广项目/常规项目
					"devnumber":this.devnumber,
					"uuid":this.uuid
				});     
				uni.showLoading({
					title:"数据提交中...",
					mask:true
				})   
				console.log(res)
				if (res.data.ret == 0) {
					uni.hideLoading();
					this.params.fid = 0;
					uni.showToast({
						icon:"success",
						title: "数据提交成功",
						mask: true,
						duration: 1000,
						success() {
							setTimeout(()=>{
								uni.showLoading() 
								_this.updateCollectData();
								
								setTimeout(() => {
									_this.isStop = true; 
									uni.hideLoading();									
									fkSuccessTips({
										systemInfo: system,
										isMinData:_this.isStudy
									})	 
								}, 1300)
								
								uni.removeStorageSync('prev_yfk_'+_this.params.pid);   // 清除上次数据
								
								uni.setStorage({
									key:'fk_data',
									data:{
										env_type: _this.params.envtype,
										remark: _this.params.remark
									}
								}) 
							},300)	
											 
						}
					})
					
				} else {
					uni.hideLoading();
					uni.showToast({
						image: '../../static/images/error.png',
						title: res.data.message,
						mask: true,
						duration: 1000,
						success() {
							setTimeout(() => {
								_this.isStop = true;
							})
						}
					})
				}
				
			},
			
			//上传轨迹信息
			addLocus: async function () {
			    let _this = this;
			    uni.setKeepScreenOn({
					keepScreenOn: true
			    }); 
			    let res = await this.$api.yfk_api.addLocus({
					'uid': this.userInfo.id,
					'fid': this.params.fid,
					'speed': (this.params.speed).toFixed(2),
					'accuracy': (this.params.accuracy).toFixed(2),
					'gcj02_lat': this.params.latitude,
					'gcj02_lng': this.params.longitude,
				}); 
				if(res.data.ret==0){
					this.params.prevlatitude = this.params.latitude;
					this.params.prevlongitude = this.params.longitude;
					
					if (this.params.fid == 0 && res.data.data > 0 && !this.prev_data.fid) {
						this.params.fid = res.data.data;
					}
				} 
			},
			
			//更新数据
			updateCollectData: async function () {
			    let _this = this;	
				let updateState=0;	
				let system = await getSystemInfo(); //  获取系统信息
				
				// uni.showLoading({
				// 	title:"数据更新中...",
				// 	mask:true
				// }) 
						
			    //更新地区代码W
				let res=await this.$api.yfk_api.adCode();  
				if(res.data.ret==0){ 
					updateState+=1;
				}  
			
			    //添加用户轨迹 
			    let addLocusUrl = await this.$api.yfk_api.addUserLocus({
			    	'uid': this.userInfo.id,
			    	'date': dateFormat('YYYY-mm-dd',new Date())
			    });  
				if(addLocusUrl.data.ret==0){
					updateState+=1;
				} 
			
			    //添加项目用户的监测点到mongodb
			    setTimeout(async () => {  
					let addMarkerUrl = await _this.$api.yfk_api.addMarkers({
					    'createUid':parseInt(_this.userInfo.id) 
					});  
					if(addMarkerUrl.data.ret==0){
						updateState+=1;
					} 
					
					this.isSaveData=true;
					// uni.showToast({
					// 	icon: 'success',
					// 	title: '数据更新成功',
					// 	mask: true,
					// 	duration: 1000,
					// 	success() {
					// 		setTimeout(() => {
					// 			_this.isStop = true; 
					// 			fkSuccessTips({
					// 				systemInfo: system,
					// 				isMinData:_this.isStudy
					// 			})	 
					// 		}, 1300)
							
					// 		uni.removeStorageSync('prev_yfk_'+_this.params.pid);   // 清除上次数据
							
					// 		uni.setStorage({
					// 			key:'fk_data',
					// 			data:{
					// 				env_type: _this.params.envtype,
					// 				remark: _this.params.remark
					// 			}
					// 		}) 
					// 	}
					// })
					
					// if(updateState==3){
						
					// }else{
					// 	uni.hideLoading();
					// 	uni.showToast({
					// 		icon: 'error',
					// 		title: '数据更新失败',
					// 		mask: true,
					// 		duration: 1000,
					// 		success() {
					// 			setTimeout(() => {
					// 				_this.isStop = true; 
					// 				uni.navigateBack({
					// 					delta:1
					// 				})
					// 			}, 300)								 
					// 		}
					// 	})
					// }
			    }, 800);
			},

		},
		components: {},

		computed: {
			userInfoStatus(){ 
				return this.$store.state.userInfoStatus;
			}
		},
		watch: {
			userInfoStatus(newer,older){
				if(newer){ 
					this.getUserInfo();
					this.submitEvent();
				}
			}
		}

	}
</script>

<style lang="less">
	.form-wrap .label {
		width: 35%;
	}

	.form-wrap .content .link {
		color: #000;
	}

	.status {
		padding: 0 20rpx;
		color: #f00;
		font-size: 28rpx;
	}

	.btn {
		@h: 80rpx;
		width: 98%;
		margin: 10rpx auto;
		text-align: center;
		height: @h;
		line-height: @h;
		background: linear-gradient(#e96b5c, #ce3c2f);
		border-radius: 10rpx;
		color: #fff;
		font-size: 34rpx;
	}

	.prev-btn {
		text-align: right;
		padding: 20rpx;

		text {
			padding: 4rpx 15rpx;
			background: #ff9600;
			border-radius: 8rpx;
			color: #fff;
			font-size: 32rpx;
		}
	}

	.prev-data {
		padding: 18rpx 10rpx;
		background: #f5f5f5;
		text-align: right;
		color: #999;
		font-size: 28rpx;

		.val {
			color: #333;
		}

		.use-btn {
			color: #d03c30;
		}
	}
</style>
